package org.seed.quantum.message.plugins;

import org.seed.quantum.socket.NetMonitor;
import org.seed.quantum.socket.AbstractSocketSession;
import org.seed.quantum.socket.SocketStateEnum;

public interface Plugin <T> extends NetMonitor {

    /**
     * 对请求消息进行预处理，并决策是否进行后续的MessageProcessor处理。
     * 若返回false，则当前消息将被忽略。
     * 若返回true，该消息会正常秩序MessageProcessor.process.
     *
     * @param session
     * @param t
     * @return
     */
    boolean preProcess(AbstractSocketSession session, T t);


    /**
     * 监听状态机事件
     *
     * @param stateMachineEnum
     * @param session
     * @param throwable
     * @see org.seed.quantum.socket.MessageProcessor#stateEvent(AbstractSocketSession, SocketStateEnum, Throwable)
     */
    void stateEvent(SocketStateEnum stateMachineEnum, AbstractSocketSession session, Throwable throwable);


}
